﻿/* Template done by
 * 
 * Richard Clark
 * Project Hoshimi Lead Manager
 * Contact at ori@c2i.fr
 * 
*/
using System;
using System.Collections.Generic;
using System.Text;

using System.Drawing;
using VG.Common;
using VG.Map;

namespace hoshimiTest
{

    [Characteristics(ContainerCapacity = 20, CollectTransfertSpeed = 5, Scan = 5, MaxDamage = 0, DefenseDistance = 0, Constitution = 20)]
    public class Collector : VG.Common.NanoCollector, IActionable
    {

        public enum CollectorWhatToDoNextAction
        {
            NothingToDo,
            MoveToHoshimi,
            CollectAZN,
            AutoDestroy,
            TransferToNeedle,
            MoveToAZN
        }

        public const int SquadNumber = 0;
        public int m_turns_of_recollection = 4;
        private CollectorWhatToDoNextAction m_WhatToDoNext = CollectorWhatToDoNextAction.NothingToDo;

        private static char[] sep = { ',' };
        public Point HP_point;

        #region IAction Members
        
        
        // Acciones del collector.
        public void DoActions()
        {
            
            switch (this.m_WhatToDoNext)
            {
                case CollectorWhatToDoNextAction.NothingToDo:
                    int x = System.Convert.ToInt32(this.InternalName.Split(sep)[0]);
                    int y = System.Convert.ToInt32(this.InternalName.Split(sep)[1]);
                    this.HP_point = new Point(x, y);
                    //this.m_WhatToDoNext = CollectorWhatToDoNextAction.MoveToAZN;
                    goto DirectAcces;
                    //break;
                case CollectorWhatToDoNextAction.CollectAZN:
                    this.CollectFrom(this.Location, m_turns_of_recollection);
                    this.m_WhatToDoNext = CollectorWhatToDoNextAction.MoveToHoshimi;
                    break;

                case CollectorWhatToDoNextAction.MoveToHoshimi:
                    //this.MoveTo(Utils.getNearestPoint(this.Location, ((myPlayer)this.PlayerOwner).HoshimiEntities));
                    this.MoveTo(HP_point);
                    this.m_WhatToDoNext = CollectorWhatToDoNextAction.TransferToNeedle;
                    break;

                case CollectorWhatToDoNextAction.TransferToNeedle:
                    this.TransferTo(this.Location, m_turns_of_recollection);
                    this.m_WhatToDoNext = CollectorWhatToDoNextAction.MoveToAZN;
                    break;

                case CollectorWhatToDoNextAction.MoveToAZN:
                    DirectAcces:
                    this.MoveTo(Utils.getNearestPoint(this.HP_point, ((myPlayer)this.PlayerOwner).AZNEntities));
                    this.m_WhatToDoNext = CollectorWhatToDoNextAction.CollectAZN;
                    break;
            }
        }

        public void SetTurnsOffRecollection(int _turns)
        {
            this.m_turns_of_recollection = _turns;
        }

        public int GetTurnsOfRecollection()
        {
            return this.m_turns_of_recollection;
        }


        #endregion
    }

    [Characteristics(ContainerCapacity = 100, CollectTransfertSpeed = 0, Scan = 10, MaxDamage = 5, DefenseDistance = 10, Constitution = 25)]
    public class Needle : VG.Common.NanoNeedle, IActionable
    {
        public const int SquadNumber = 0;
        #region IAction Members
        public void DoActions()
        { }
        #endregion
    }

    [Characteristics(ContainerCapacity = 0, CollectTransfertSpeed = 0, Scan = 30, MaxDamage = 0, DefenseDistance = 0, Constitution = 10)]
    public class Explorer : VG.Common.NanoExplorer, IActionable
    {
        public const int SquadNumber = 0;
        #region IAction Members
        public void DoActions()
        { }
        #endregion
    }

    [Characteristics(ContainerCapacity = 0, CollectTransfertSpeed = 0, Scan = 5, MaxDamage = 5, DefenseDistance = 12, Constitution = 25)]
    public class Protector : VG.Common.NanoCollector, IActionable
    {
        public const int SquadNumber = 0;
        #region IAction Members
        public void DoActions()
        { }
        #endregion
    }
}
